package com.lrkj.back.service.impl;

import java.util.List;
import java.util.Map;

import com.lrkj.back.mapper.ZsMiejunMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lrkj.back.entity.ZsMiejun;
import com.lrkj.back.service.ZsMiejunService;
import cn.com.cbons.mamisay.parent.db.api.DBInterface;
import cn.com.cbons.mamisay.parent.exception.DBException;
import cn.com.cbons.mamisay.parent.service.base.ParentServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Transactional
@Service("miejunService")
public class ZsMiejunServiceImpl extends ParentServiceImpl<ZsMiejun> implements ZsMiejunService {

    @Autowired
    private ZsMiejunMapper zsMiejunMapper;

    @Override
    public PageInfo<ZsMiejun> findAllMiejun(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsMiejun> tbList = zsMiejunMapper.findAllMiejun(map);
        PageInfo<ZsMiejun> page = new PageInfo<>(tbList);
        return page;
    }

    @Override
    public List<ZsMiejun> findAllMiejunNoPage(Map<String, Object> map) throws DBException {
        return zsMiejunMapper.findAllMiejun(map);
    }

    @Override
    protected DBInterface<ZsMiejun> getDao() throws DBException {
        return zsMiejunMapper;
    }

    @Override
    public PageInfo<ZsMiejun> findByZhuangtai(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsMiejun> tbList = zsMiejunMapper.findAllMiejun(map);
        PageInfo<ZsMiejun> page = new PageInfo<ZsMiejun>(tbList);
        return page;
    }

    @Override
    public int updateByBatch(List<ZsMiejun> list) throws DBException {
        return zsMiejunMapper.updateByBatch(list);
    }

    @Override
    public PageInfo<ZsMiejun> findByShenheTime(Map<String, Object> map) throws DBException {
        PageHelper.startPage(Integer.valueOf(map.get("pageNo").toString()),
                Integer.valueOf(map.get("pageSize").toString()));
        List<ZsMiejun> tbList = zsMiejunMapper.findByShenheTime(map);
        PageInfo<ZsMiejun> page = new PageInfo<ZsMiejun>(tbList);
        return page;
    }

    @Override
    public ZsMiejun findOne(Map<String, Object> map) throws DBException {
        return zsMiejunMapper.findOne(map);
    }

}
